package happy.diandiankong.api.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

/**
 * Title.
 * <p>
 * Description.
 *
 * @author Bill Lv {@literal <billcc.lv@hotmail.com>}
 * @version 1.0
 * @since 2016-08-10
 */
public class KickStarterNutshell implements Serializable {
    Long id;
    Integer status;
    String title;
    Long thumbnail;
    Long categoryId;
    String categoryName;
    String intro;
    Double targetAmt;
    Integer percentageComplete;
    Integer collected;
    Integer daysRemaining;

    public KickStarterNutshell() {
    }

    public KickStarterNutshell(Long id, Integer status, String title, Long thumbnail, Long categoryId, String categoryName, String intro, Double targetAmt, Integer percentageComplete, Integer collected, Integer daysRemaining) {
        this.id = id;
        this.status = status;
        this.title = title;
        this.thumbnail = thumbnail;
        this.categoryId = categoryId;
        this.categoryName = categoryName;
        this.intro = intro;
        this.targetAmt = targetAmt;
        this.percentageComplete = percentageComplete;
        this.collected = collected;
        this.daysRemaining = daysRemaining;
    }

    @JsonProperty
    public Long getId() {
        return id;
    }

    @JsonProperty
    public Integer getStatus() {
        return status;
    }

    @JsonProperty
    public String getTitle() {
        return title;
    }

    @JsonProperty
    public Long getThumbnail() {
        return thumbnail;
    }

    @JsonProperty
    public Long getCategoryId() {
        return categoryId;
    }

    @JsonProperty
    public String getCategoryName() {
        return categoryName;
    }

    @JsonProperty
    public String getIntro() {
        if (StringUtils.isEmpty(intro)) {
            return "";
        } else {
            final int length = intro.length();
            return intro.substring(0, length > 25 ? 25 : length) + "...";
        }
    }

    @JsonProperty
    public Double getTargetAmt() {
        return targetAmt;
    }

    @JsonProperty
    public Integer getPercentageComplete() {
        return percentageComplete;
    }

    @JsonProperty
    public Integer getCollected() {
        return collected;
    }

    @JsonProperty
    public Integer getDaysRemaining() {
        return daysRemaining;
    }
}
